<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Testcafe screenshot sizing issue</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: black;
        }

        div.wrapper {
            position: relative;
            height: 5000px;
        }

        div.d {
            width: 50px;
            height: 50px;
            position: absolute;
        }

        .left {
            left: 0;
        }

        .right {
            right: 0;
        }

        .top {
            top: 0;
        }

        .bottom {
            bottom: 0;
        }

        .red {
            background-color: rgb(255, 0, 0);
        }

        .green {
            background-color: rgb(0, 255, 0);
        }

        @media screen and (max-width: 1023px) {
            .red {
                background-color: rgb(0, 255, 0);
            }

            .green {
                background-color: rgb(255, 0, 0);
            }
        }
    </style>
</head>

<body>
    <div class="wrapper">
        <div class="d left top red"></div>
        <div class="d right top green"></div>
        <div class="d left bottom green"></div>
        <div class="d right bottom red"></div>
    </div>
</body>

</html>